#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define  endl  '\n'


bool judge(ll a[], int n, ll m) {
    sort(a, a + n);
    for (int i = 0; i < n; i++) {
        if (binary_search(a + i + 1, a + n, m - a[i])) {
            cout << a[i] << " " << m - a[i] << endl;
            return true;
        }
    }
    return false;

}

const int maxn = 1e6 + 100;
ll a[maxn];

int main() {

    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll m;
    cin >> m;
    if (!judge(a, n, m)) {
        cout << "No" << endl;
    }
    return 0;
}